<template>
    <div>

<h2> home 组件</h2>
<h2>{{count}}</h2>

  <button @click="addCount">点击++</button>
   <button @click="subCount">点击--</button>


<hr>
<div>{{addCountGetters}}</div>

    </div>
</template>

<script>
import  {mapGetters,mapState} from 'vuex'
export default {
    data() {
        return {

        };
    },
    created() {
        this.$axios.get('https://locally.uieee.com/slides')
        .then(res=>{
            console.log(res.data)
        }),

        this.$axios.get('/api/home')
        .then(res=>{
            console.log(res.data)
        }),
         this.$axios.post('/api/news')
        .then(res=>{
            console.log(res.data)
        })



    },
    mounted() {

    },
    methods: {
        addCount() {
            // alert('++')
            this.$store.dispatch('addCountActions')
        },
        subCount() {
            // alert('--')
            this.$store.dispatch('subCountActions')

            
        }

    },
    computed: {
        ...mapState(['count']),
        ...mapGetters(['addCountGetters'])
      
    },
};
</script>

<style scoped   lang='css'>

</style>
